<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Adminis
  Date: 2025/3/19
  Time: 11:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>权限管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/admin/js/jquery-2.1.0.min.js"></script>
    <script src="${pageContext.request.contextPath}/admin/js/bootstrap.min.js"></script>
    <style>
        .cus-container {
            width: 1368px;
        }

        #user-add .modal-content {
            padding: 0 20px 20px;
        }

        #user-edit .modal-content {
            padding: 0 20px 20px;
        }

        #user-list td {
            vertical-align: middle;
        }
        #child td{
            padding-left: 60px;
        }
    </style>
</head>
<body>

<div class="container cus-container">
    <h3 class="text-center">权限信息列表</h3>

    <div>
        <!-- 搜索框div -->
        <div id="search-user" style="float: left; margin: 10px 0px;">
            <form class="form-inline" action="${pageContext.request.contextPath}/acl_permission/selectAcl_permissions" method="post">
                <div class="form-group">
                    <label for="name">名称</label>
                    <input type="text" name="name" value="${name}" class="form-control" id="name" >
                </div>
                <div class="form-group">
                    <label for="path">路径</label>
                    <input type="text" name="path" value="${path}" class="form-control" id="path" >
                </div>
                <button type="submit" class="btn btn-default" >查询</button>
            </form>
        </div>

        <!-- 添加、删除的按钮 -->
        <div style="float: right;margin: 10px 0px;">
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/acl_permission/toInsertAcl_permissionParent">添加权限</a>
        </div>
    </div>


    <table class="table table-bordered clearfix" id="user-list">
        <thead>
        <tr class="bg-primary">
            <th>权限名称</th>
            <th>访问路径</th>
            <th>权限操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${acl_permissions}" var="acl_permission">
            <tr>
                <td>${acl_permission.name}</td>
                <td>${acl_permission.path}</td>
                <td>
                    <a class="btn btn btn-danger btn-sm" href="${pageContext.request.contextPath}/acl_permission/deleteAcl_permission?perm_id=${acl_permission.perm_id}">删除</a>
                    <a class="btn btn btn-primary btn-sm" href="${pageContext.request.contextPath}/acl_permission/toUpdateAcl_permission?perm_id=${acl_permission.perm_id}">修改</a>
                    <a class="btn btn btn-primary btn-sm" href="${pageContext.request.contextPath}/acl_permission/toInsertAcl_permissionParent?perm_id=${acl_permission.perm_id}">增加子权限</a>
                </td>
            </tr>
            <c:forEach items="${acl_permission.children}" var="child">
                <tr id="child">
                    <td>${child.name}</td>
                    <td>${child.path}</td>
                    <td>
                        <a class="btn btn btn-danger btn-sm" href="${pageContext.request.contextPath}/acl_permission/deleteAcl_permission?perm_id=${child.perm_id}">删除</a>
                        <a class="btn btn-primary btn-sm" href="${pageContext.request.contextPath}/acl_permission/toUpdateAcl_permission?perm_id=${child.perm_id}">修改</a>
                    </td>
                </tr>
            </c:forEach>
        </c:forEach>

        </tbody>
    </table>

    <!-- 分页导航 -->
    <div>
        <!-- 分页导航 -->
        <nav style="float: left;">
            <ul class="pagination">
                <li>
                    <a href="#" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <li><a href="#">1</a></li>
                <li><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li><a href="#">4</a></li>
                <li><a href="#">5</a></li>
                <li>
                    <a href="#" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
        <div style="float: right;margin-top: 25px;">
            <span>共100条记录，分20页显示</span>
        </div>
    </div>
</div>


</body>
</html>